"use strict";
const common_vendor = require("../../../../../../../common/vendor.js");
const common_assets = require("../../../../../../../common/assets.js");
if (!Array) {
  const _easycom_up_text2 = common_vendor.resolveComponent("up-text");
  const _easycom_up_button2 = common_vendor.resolveComponent("up-button");
  (_easycom_up_text2 + _easycom_up_button2)();
}
const _easycom_up_text = () => "../../../../../../../node-modules/uview-plus/components/u-text/u-text.js";
const _easycom_up_button = () => "../../../../../../../node-modules/uview-plus/components/u-button/u-button.js";
if (!Math) {
  (_easycom_up_text + _easycom_up_button)();
}
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "index",
  setup(__props) {
    const user = common_vendor.ref({
      name: "熊翱",
      date: "2024-06-28",
      height: 170,
      weight: 57.9
    });
    const isValid = common_vendor.ref(true);
    function handleInput(event) {
      const target = event.target;
      let value = Number.parseFloat(target.value);
      if (value < 0) {
        value = 0;
      } else if (value > 300) {
        value = 300;
      }
      user.value.height = value;
    }
    common_vendor.watch(() => user.value.height, (newHeight) => {
      if (newHeight < 0 || newHeight > 300) {
        isValid.value = false;
      } else {
        isValid.value = true;
      }
    });
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_assets._imports_0,
        b: common_vendor.p({
          mode: "name",
          text: user.value.name,
          bold: "true",
          format: "encrypt"
        }),
        c: common_vendor.p({
          text: "记录日期"
        }),
        d: common_vendor.p({
          text: user.value.date,
          align: "right"
        }),
        e: common_vendor.p({
          text: "请输入你的身高",
          bold: "true"
        }),
        f: !isValid.value ? 1 : "",
        g: common_vendor.o([($event) => user.value.height = $event.detail.value, handleInput]),
        h: user.value.height,
        i: common_vendor.p({
          text: "cm",
          align: "right"
        }),
        j: !isValid.value
      }, !isValid.value ? {} : {}, {
        k: common_vendor.p({
          text: "请输入你的身高",
          bold: "true"
        }),
        l: !isValid.value ? 1 : "",
        m: common_vendor.o([($event) => user.value.weight = $event.detail.value, handleInput]),
        n: user.value.weight,
        o: common_vendor.p({
          text: "kg",
          align: "right"
        }),
        p: !isValid.value
      }, !isValid.value ? {} : {}, {
        q: common_vendor.p({
          type: "primary",
          text: "增加记录"
        })
      });
    };
  }
});
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-cbc3108c"]]);
wx.createPage(MiniProgramPage);
